//
// Created by hay boy on 2022/6/23.
//

#ifndef ALGORITHMS_MATRIX_H
#define ALGORITHMS_MATRIX_H
#include "../exception/illegalParameterValue.h"
#include <iostream>
using namespace std;
template<class T>
class matrix{
    template<class Y>
    friend ostream& operator<<(ostream&,const matrix<Y>&);
    template<class Y>
    friend istream& operator>>(istream& in,const matrix<Y>& m);
public:
    explicit matrix(int theRow=0,int theColumns=0);
    matrix(const matrix<T>&);
    ~matrix(){
        delete[]element;
    }
    int row()const{
        return theRows;
    }
    int columns(){
        return theColumns;
    }
    T& operator()(int i,int j)const;
    matrix<T> tranpose();
    matrix<T>& operator=(const matrix<T>&);
    matrix<T> operator+()const;
    matrix<T> operator+(const matrix<T>&)const;
    matrix<T> operator-()const;
    matrix<T> operator-(const matrix<T>&) const;
    matrix<T> operator*(const matrix<T>&) const;
    matrix<T>& operator+=(const T&);
    matrix<T>& operator-=(const T&);
    matrix<T>& operator*=(const T&);
    matrix<T>& operator/=(const T&);
private:
    int theRows,theColumns;
    T* element;
};
#endif //ALGORITHMS_MATRIX_H
